<?php

namespace Xin\Hint\Laravel;

use Illuminate\Http\JsonResponse;

class ApiRender extends AbstractRender
{

	/**
	 * @inheritDoc
	 */
	public function render($data = null, array $options = [])
	{
		$jsonEncodeOptions = isset($options['json_encode_options']) ? $options['json_encode_options'] : JsonResponse::DEFAULT_ENCODING_OPTIONS | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
		return new JsonResponse($this->optimizeData($data), 200, [], $jsonEncodeOptions);
		//        return Response::json($this->optimizeData($data));
	}

	/**
	 * @inheritDoc
	 */
	public function isAjax()
	{
		return true;
	}

}
